#ifndef FORMPAYMENTS_H
#define FORMPAYMENTS_H

#include <QWidget>
#include "dbmscontainer.h"
#include <QCompleter>
#include <QStringListModel>
#include "paymentsmodel.h"


namespace Ui {
    class FormPayments;
}

class FormPayments : public QWidget, public DbmsContainer
{
    Q_OBJECT
    QStringListModel *mp_qstr_model;
    QCompleter *mp_completer;
    QVariantList mqvl_s_indices;
    QVariant mqv_current_s_index;
    QVariantList mqvl_h_indices;
    QVariantList mqvl_ap_indices;
    QVariant mqv_current_h_index;
    QVariant mqv_current_a_index;
    QVariant mqv_bill_index;
    PaymentsModel *mp_model;
    QVariantHash mqvh_spaces;
protected:
    void resizeEvent(QResizeEvent *);
public:
    explicit FormPayments(QWidget *parent = 0);
    void set_dbms(HousingDBMS *p_dbms);
    void update_data();
    ~FormPayments();

private:
    Ui::FormPayments *ui;
private slots:
    void completer_activated(const QModelIndex &index);
    void hcombo_current_changed();
    void apcombo_current_changed();
    void update_spaces_list();
    void set_checked_all_spaces();
    void set_unchecked_all_spaces();
    void show_payments();
    void resize_table();
    void del_payment();
    void add_payment();
    void bill_number_edited(QString text);
};

#endif // FORMPAYMENTS_H
